﻿@model Product

@{
    ViewData["Title"] = "饮品详情";
}

<div class="container mt-4">
    <h2 class="mb-4">@ViewData["Title"]</h2>

    <div class="card">
        <div class="row g-0">
            <!-- 图片展示区 -->
            <div class="col-md-4 border-end">
                @if (!string.IsNullOrEmpty(Model.Image))
                {
                    <img src="@Model.Image" class="img-fluid rounded-start" alt="商品图片" style="max-height: 400px;">
                }
                else
                {
                    <div class="d-flex align-items-center justify-content-center bg-light" style="height: 400px;">
                        <i class="bi bi-image text-muted" style="font-size: 3rem;"></i>
                    </div>
                }
            </div>

            <!-- 详细信息区 -->
            <div class="col-md-8">
                <div class="card-body">
                    <dl class="row">
                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.ProductNo)</dt>
                        <dd class="col-sm-9">@Model.ProductNo</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.Name)</dt>
                        <dd class="col-sm-9">@Model.Name</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.Price)</dt>
                        <dd class="col-sm-9">@Model.Price.ToString("C")</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.Stock)</dt>
                        <dd class="col-sm-9">
                            @Model.Stock
                            <span class="badge @(Model.Stock > 0 ? "bg-success" : "bg-danger") ms-2">
                                @(Model.Stock > 0 ? "有货" : "缺货")
                            </span>
                        </dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.LimitStock)</dt>
                        <dd class="col-sm-9">@Model.LimitStock</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.Supplier)</dt>
                        <dd class="col-sm-9">@Model.Supplier</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.ProduceDate)</dt>
                        <dd class="col-sm-9">@Model.ProduceDate.ToString("f")</dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.QualityPeriod)</dt>
                        <dd class="col-sm-9">@Model.QualityPeriod 月/dd>

                        <dt class="col-sm-3">@Html.DisplayNameFor(m => m.Status)</dt>
                        <dd class="col-sm-9">
                            @switch (Model.Status)
                            {
                                case 0:
                                    <span class="badge bg-success">未上架</span>
                                    break;
                                case 1:
                                    <span class="badge bg-secondary">已上架</span>
                                    break;
                                default:
                                    @Model.Status
                                    break;
                            }
                        </dd>
                    </dl>

                    <div class="mt-4">
                        <a asp-action="Index" class="btn btn-outline-secondary">
                            <i class="bi bi-arrow-left"></i> 返回列表
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section Styles {
    <style>
        .card {
            border-radius: 15px;
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        }

        dt {
            font-weight: 500;
            color: #6c757d;
        }

        dd {
            margin-bottom: 1rem;
        }
    </style>
}